package com.uifp.gradebook.business_objects;

import java.util.ArrayList;
import java.util.ListIterator;


public class Class {

	private String name;
	private String prof;
	private String desc;
	private ArrayList<Grade> gradeList;
	
	public Class(){
		this.name = "";
		this.prof = "";
		this.desc = "";
		this.gradeList = new ArrayList<Grade>();
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getProf() {
		return prof;
	}
	public void setProf(String prof) {
		this.prof = prof;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public ArrayList<Grade> getGradeList() {
		return gradeList;
	}
	public void setGradeList(ArrayList<Grade> gradeList) {
		this.gradeList = gradeList;
	}
	
	public void suffixLabels(){
		ListIterator<Grade> itr =  gradeList.listIterator();
		Grade thisGrade = new Grade();
		int i = 1;
		String thisCategory = "";
		while(itr.hasNext()){
			thisGrade = itr.next();
			if(!thisGrade.getHeadingString().equals(thisCategory)){
				i = 1;
			}
			thisCategory = thisGrade.getHeadingString();
			String heading = thisCategory + " " + i;
			thisGrade.setHeadingString(heading);
			itr.set(thisGrade);
			i++;
		}
	}
}
